<%@page import="shmged.com.shlcm.utils.CmIBAHelper"%>
<%@page import="wt.doc.WTDocument"%>
<%@page import="wt.fc.ReferenceFactory"%>
<%@page import="wt.httpgw.URLFactory"%>
<%@page import="shmged.com.shlcm.utils.CmShmgedType"%>
<%@page import="shmged.com.shlcm.utils.CmSettings"%>
<%@page import="shmged.com.shlcm.utils.CmHSSFWorkbookHelper" %>
<%@page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="wt.httpgw.URLFactory"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

	
<%
	ReferenceFactory rf=new ReferenceFactory();
    String baseUrl = new URLFactory().getBaseHREF();
	String oid = request.getParameter("oid").trim();
	WTDocument doc = (WTDocument)rf.getReference(oid).getObject();
	String number=doc.getNumber();
	String projectScheduleOid = request.getParameter("projectScheduleOid").trim();
	WTDocument projectScheduleDoc=(WTDocument)rf.getReference(projectScheduleOid).getObject();
	Map fileMap=CmHSSFWorkbookHelper.downDocPri(projectScheduleDoc);
%>
<head>
    <title>创建项目计划</title>
</head>

<body>
<center>
<div style="display:none" >
<div style="width: 560px;height: auto" id="browseUpdateProjectSchedule" >

<form id="updateProjectSchedu" method="post" ENCTYPE="multipart/form-data" action="<%=baseUrl %>shmged/jsp/com/shlcm/projects/jspUpdateProjectSchedule.jsp">
	<input type="hidden" id="projectScheduleOid" name="projectScheduleOid" value="<%=projectScheduleOid %>"/>
	<table border="1px" bordercolor="00BFFF" cellspacing="0px" style="border-collapse:collapse" class="easyui-panel" width="100%">
		<tr>
			<td rowspan=1 colspan=4  align=center  height="40">修改项目计划</td>
   		</tr>
   		<tr>
			<td align="right">当前项目计划:</td>
			<td colspan="3"><a href="javaScript:void(0)" onclick="downDocPriFile('<%=fileMap.get("path") %>','<%=fileMap.get("name") %>')"><%=fileMap.get("name") %></a> </td>
		</tr>
		<tr>
			<td align="right">项目计划名称:</td>
			<td colspan="3"><input class="easyui-validatebox" type="text" name="updateMBAname" id="updateMBAname" value="<%=projectScheduleDoc.getName() %>" data-options="required:true,missingMessage:'项目进度名称！'" size="60"></input></td>
		</tr>
		<tr>
			<td align="right">上传项目计划附件:</td>
			<td colspan="3"><input type="file" name="updateInp_primary_file"   id="updateInp_primary_file" size="50" id="inp_primary_file"/></td>
		</tr>
		</table>
		<br>
</form>

	    <div style="text-align:center;padding:5px;">
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitUpdateForm()">提交</a>
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearUpdateForm()">重置</a>
	    </div>
	     <div style="display: none;">
	      <form action="<%=baseUrl %>shmged/jsp/com/shlcm/projects/viewProjectSchedule.jsp" id="jumpPageId">
	          <input type="hidden" name="oid" value="" id="jumpOidId"/> 
	      </form>
	    </div>
<SCRIPT LANGUAGE="JavaScript">
function submitUpdateForm(){
	$('#updateProjectSchedu').form('submit',{
		onSubmit:function (){
			//alert("amCreateProject");
			var fileVal = $("#updateInp_primary_file").val();
			if("" == fileVal){
				alert("请选择项目文件!");
				return false;
			}
			//alert(fileVal);
			var upfile = fileVal.toUpperCase();
			//alert(upfile);
			//alert(upfile.length);
			var index = upfile.lastIndexOf(".XLS");
			if(upfile.length != (index + ".XLS".length)){
				alert("项目计划文件只能是xls文件!");
				return false;
			}
			//return true;
			//alert(index);
		},
		success:function (data){
			//alert(data);
			if(data.indexOf("ERROR:") != -1){
				alert(data);
			}else{
				refeProjectSch();
				$('#browseUpdateProjectSchedule').window('close');
			}
		}
	});
	//$('#createProjectSchedu').form('submit');
	//$('#amCreateProject').form('submit');
	//$('#createProjectSchedu').submit();
	
}
function clearUpdateForm(){
	$('#updateProjectSchedu').form('clear');
}


function browseUpdateProjectSchedule(){
	  $('#browseUpdateProjectSchedule').window({
		     collapsible:false,
		     minimizable:false,
		     maximizable:false,
		     resizable:false,
		     title:"修改项目计划",
			 width:580,
		     //height:550,
		     modal:true,
		     left:300,
		     onClose:function(){
		  		refeProjectSch();
		  	 $('#browseUpdateProjectSchedule').window("destroy");
		     }
		 });
}



function refeProjectSch(){
	
		var number='<%=number%>信息';
		$("#cmTabs").tabs('select',number);  
	  var tab = $('#cmTabs').tabs('getSelected');
	  $("#cmTabs").tabs('update',{  
	  tab:tab,  
	  options:{  
	     title:number,  
	     style:{padding:'1px'},  
	 //href:URL, // 使用href会导致页面加载两次，所以使用content代替   
	     content:'<iframe name="indextab" scrolling="auto" frameborder="0" style="width:100%;height:100%;"></iframe>',  
		 closable:false,  
		 fit:true,  
		 selected:true,  
		 closable:true
	  }  
   });  
}

function downDocPriFile(path,name)
{
	var url="<%=baseUrl%>";
	window.location.href=url+"shmged/jsp/com/shlcm/documents/downFile.jsp?path="+path+"&name="+name;
}

</script>
</div>
</div>
</center>
</body>

